import request from '@/utils/request'

// 查询档案列表列表
export function listArchive(query) {
  return request({
    url: '/manage/archive/list',
    method: 'get',
    params: query
  })
}

// 查询档案列表详细
export function getArchive(id) {
  return request({
    url: '/manage/archive/' + id,
    method: 'get'
  })
}

// 查询当前档案的查看权限
export function ArchivePermission(id) {
  return request({
    url: '/manage/archive/permission/' + id,
    method: 'get',
  })
}

// 新增档案列表
export function addArchive(data) {
  return request({
    url: '/manage/archive',
    method: 'post',
    data: data
  })
}

// 修改档案列表
export function updateArchive(data) {
  return request({
    url: '/manage/archive',
    method: 'put',
    data: data
  })
}

// 删除档案列表
export function delArchive(id) {
  return request({
    url: '/manage/archive/' + id,
    method: 'delete'
  })
}

// 新增档案文档目录
export function addDirectoryFiles(data) {
  return request({
    url: '/manage/archive/directory',
    method: 'put',
    data: data
  })
}

// 删除档案文档目录
export function deleteDirectoryFiles(data) {
  return request({
    url: '/manage/archive/directory/delete',
    method: 'put',
    data: data
  })
}

// 根据location查询档案列表
export function listArchiveByLocation(query) {
  return request({
    url: '/manage/archive/location',
    method: 'get',
    params: { location: query }
  })
}

// 拖拽移动档案
export function moveArchive(archiveId, targetLocation) {
  return request({
    url: '/manage/archive/move',
    method: 'post',
    data: { archiveId, targetLocation }
  });
}

// 节层中档案全部下架
export function updateArchivesLocation(archives) {
  return request({
    url: '/manage/archive/updateLocation',
    method: 'post',
    data: archives
  })
}

// 得到未上架的档案列表
export function getUpArchiveList(query) {
  return request({
    url: '/manage/archive/upArchiveList',
    method: 'get',
    params: query
  })
}